<tagLib name="strends" />
<include file="Public:header" />
<script type="text/javascript" src="__TMPL__Static/Js/dataList.js"></script>
<div class="handle-btns">
	<strends:imageBtn id="addData" name="addData" value="{%ADD}" click="addData()" />
	<strends:imageBtn id="editData" name="editData" value="{%EDIT}" click="editData(this,'checkList','tag_id')" />
	<strends:imageBtn id="removeData" name="removeData" value="{%REMOVE}" click="removeData(this,'checkList')" />
    <form action="__APP__">
		<span>{%TAG_TYPE}</span>
		<select name="tagtype">
			<option value="" <if condition="$tagtype eq -1">selected="selected"</if>>{%TAGALL}</option>
			<option value="0" <if condition="$tagtype eq 0">selected="selected"</if>>{%NORMAL}</option>
			<option value="1" <if condition="$tagtype eq 1">selected="selected"</if>>{%STYLE}</option>
			<option value="2" <if condition="$tagtype eq 2">selected="selected"</if>>{%ITEM}</option>
			<option value="3" <if condition="$tagtype eq 3">selected="selected"</if>>{%SPEC}</option>
			<option value="4" <if condition="$tagtype eq 4">selected="selected"</if>>{%BRAND}</option>
			<option value="5" <if condition="$tagtype eq 5">selected="selected"</if>>{%MATERIAL}</option>
			<option value="6" <if condition="$tagtype eq 6">selected="selected"</if>>{%GOODS}</option>
		</select>
		<small></small>
		<span>{%TAG_NAME}</span>
		<input class="textinput" type="text" value="{$tag_name}" name="tag_name" size="20" />
		<small></small>
		<input class="submit_btn" type="submit" value="{%SEARCH}" />
		<input type="hidden" name="{:c('VAR_MODULE')}" value="{$module_name}" />
		<input type="hidden" name="{:c('VAR_ACTION')}" value="index" />
	</form>
</div>
<strends:list id="checkList" pk="tag_id" style="list" name="tag" checkbox="true" action="true" 
datasource="list" 
show="tag_id:{%ID}|50,tag_name:{%TAG_NAME}|~left:textEdit|tag_id,sort:{%SORT}|80:numberEdit|tag_id,count:{%COUNT}|100,type|getTagType:{%TYPE}|100,is_hot|getStatusImg:{%IS_HOT}|50:toggleStatus|tag_id" 
actionlist="editData:{%EDIT}:tag_id,removeData:{%REMOVE}:tag_id" 
action_width="100" action_align="center"/>
<div class="pager">{$page}</div>
<script type="text/javascript">
function toggleNormal(obj,id,pk){
	toggleType(obj,id,pk,0);
}

function toggleStyle(obj,id,pk){
	toggleType(obj,id,pk,1);
}

function toggleItem(obj,id,pk){
	toggleType(obj,id,pk,2);
}

function toggleSpec(obj,id,pk){
	toggleType(obj,id,pk,3);
}

function toggleBrand(obj,id,pk){
	toggleType(obj,id,pk,4);
}

function toggleMaterial(obj,id,pk){
	toggleType(obj,id,pk,5);
}

function toggleGoods(obj,id,pk){
	toggleType(obj,id,pk,6);
}

function toggleType(obj,id,pk,type){
	var query = new Object();
	query.id = id;
	$.ajax({
		url: APP + '?' + VAR_MODULE + '=' + CURR_MODULE + '&' + VAR_ACTION + '=toggleType&id='+id+'&type='+type,
		type:"POST",
		cache: false,
		data:query,
		dataType:"json",
		success: function(result){
			if(result.isErr == 0)
				location.reload(true);
			else
				$.ajaxError(result.content);
		}
	});
}
</script>
<include file="Public:footer" />